<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>17.DOM节点借用Array原型方法</title>
</head>

<body>
  <button message="后盾人" class="red">后盾人</button>
  <button message="hdcms">hdcms</button>
</body>
<script>
  let btns = document.querySelectorAll("button");
  console.dir([]);
  //length : 0 [[Prototype]] : ... filter : ƒ filter()
  // Array.prototype可以用 [] 代替，会在原型链上找到filter方法
  // 只需要一个参数所以用call
  btns = Array.prototype.filter.call(btns, item => {
    return item.hasAttribute("class");
  });
  console.log(btns[0]);//<button message="后盾人" class="red">后盾人</button>
</script>

</html>